  import {mapGetters} from 'vuex'
  export default{
    computed:{
      ...mapGetters('cart',['total'])
    },
    onShow() {
      this.setBar()
    },
    methods:{
      setBar(){
        uni.setTabBarBadge({
          index:2,
          text:this.total + ''
        })
      }
    },
     watch:{
       total: {
         handler(newVal){ 
           this.setBar() 
        }, 
        immediate:true }
        }
    }